﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.pp.utils;
using SharpSqlAnalyzer.stmt;

namespace SharpSqlAnalyzer.pp.processor.type.comm
{
	// Token: 0x02000254 RID: 596
	public class DistinctKeyWordProcessor : AbstractProcessor
	{
		// Token: 0x06001330 RID: 4912 RVA: 0x0031D5B8 File Offset: 0x0031B7B8
		public override void process(TParseTreeNode nodeArg)
		{
			TSelectSqlStatement tselectSqlStatement = nodeArg as TSelectSqlStatement;
			bool parameter = this.getParameter<bool>(typeof(bool));
			TSelectSqlStatement tselectSqlStatement2 = tselectSqlStatement;
			if (parameter)
			{
				TSourceToken startToken = tselectSqlStatement2.startToken;
				TSourceToken startToken2 = tselectSqlStatement2.ResultColumnList.getResultColumn(0).startToken;
				int num = SourceTokenSearcher.IndexOf(startToken.container, startToken.posinlist, startToken2.posinlist, "distinct");
				if (num > 0)
				{
					TResultColumn tresultColumn = new TResultColumn();
					TExpression texpression = new TExpression();
					TObjectName tobjectName = new TObjectName();
					tobjectName.init(startToken.container.get(num));
					texpression.ObjectOperand = tobjectName;
					tresultColumn.init(texpression);
					tresultColumn.startToken = startToken.container.get(num);
					tresultColumn.endToken = startToken.container.get(num);
					TResultColumnList tresultColumnList = new TResultColumnList();
					tresultColumnList.addResultColumn(tresultColumn);
					for (int i = 0; i < tselectSqlStatement2.ResultColumnList.size(); i++)
					{
						tresultColumnList.addResultColumn(tselectSqlStatement2.ResultColumnList.getResultColumn(i));
					}
					tselectSqlStatement2.ResultColumnList = tresultColumnList;
				}
			}
		}
	}
}
